#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define N 5
int * get_memory_addr() {
    int * addr = NULL;
    addr = (int *)malloc(sizeof(int) * 5);
    if (NULL == addr) {
        printf("malloc failed\n");
    }
    //初始化
    memset(addr, 0, sizeof(int) * 5);
    return addr;
}
void input_array(int *p) {

    int i = 0;
    printf("please input %d data :\n", N);
    for (i = 0; i < N; i++) {
        scanf("%d", &p[i]);
    }
}

void output_array(int *p) {
    int i = 0;
    for (i = 0; i < N; i++) {
        printf("%d ", p[i]);
    }
}


int main(int argc, char const *argv[])
{
    /* code */
    int *t = NULL;
    t = get_memory_addr();
    input_array(t);
    output_array(t);
    free(t);
    t = NULL;
    return 0;
}
